<template>
	<view class="home">
		<uni-nav-bar shadow left-icon="home" title="设置预览" @clickLeft="back" />
		<uni-card :is-shadow="true" :border="false">
			<view>
				<view class="top">
					<view>TO小魔仙</view>
					<view style="font-size: 2rem;">···</view>
				</view>
				<view class="line">
					早上好吖~ <text v-if="setData.riqi">今天是{{setData.riqi}}</text>
				</view>
				<view v-if="setData.caihongpi" class="line">
					{{setData.caihongpi}}
				</view>
				<view v-if="setData.tianqi" class="line">
					今日天气：{{setData.tianqi}}
				</view>
				<view v-if="setData.high" class="line">
					最高气温：{{setData.high}}
				</view>
				<view v-if="setData.low" class="line">
					最低气温：{{setData.low}}
				</view>
				<view v-if="setData.lianai" class="line">
					我们已经恋爱了：{{setData.lianai}}
				</view>
				<view v-if="setData.shengri" class="line">
					距离宝贝的生日还有：{{setData.shengri}}
				</view>
				<view v-if="setData.beizhu" class="line">
					我还想对你说：{{setData.beizhu}}
				</view>
				<view v-if="setData.jinju" class="line">
					{{setData.jinju}}
				</view>
			</view>
		</uni-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				setData: {}
			}
		},
		onLoad(option) {
			// console.log(JSON.parse(option.setData));
			console.log(option);
			if (option && option.setData && option.setData !== 'undefined') {
				console.log(JSON.parse(option.setData))
				// console.log(this.setData);
				this.setData = JSON.parse(option.setData)
			}
		},
		methods: {
			back() {
				let pages = getCurrentPages()
				if (pages.length > 1) {
					uni.navigateBack({
						delta: 1
					})
				} else {
					uni.reLaunch({
						url: "/pages/index/index"
					})
				}
			},
		}
	}
</script>

<style scoped>
	.home {
		background-color: #f9f9f9;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		color: black;
	}

	.top {
		display: flex;
		justify-content: space-between;
		color: black;
	}

	.line {
		padding: .5rem 0;
	}
</style>
